package twentytwentyone_3;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2021-03-24 11:23
 * @Modified By:
 */
public class HasAlternatingBits_693 {
    public static void main(String[] args){

    }

    public boolean hasAlternatingBits(int n){
        String s = Integer.toBinaryString(n);
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length - 1; i++) {
            if (chars[i] == chars[i + 1]){
                return false;
            }
        }
        return true;
    }
}
